import { Shape } from "../Shape";

export class Rect extends Shape {
  _sceneFunc(ctx: CanvasRenderingContext2D): void {
    ctx.beginPath();
    const { stroke, fill, top, left } = this.attrs;
    ctx.strokeStyle = stroke;
    ctx.fillStyle = fill;
    ctx.rect(left, top, this.getWidth(), this.getheight());
    ctx.stroke();
    ctx.fill();
  }

  _sceneHit(ctx: CanvasRenderingContext2D): void {
    ctx.beginPath();
    const { stroke, fill, top, left } = this.attrs;

    ctx.strokeStyle = this.colorKey;
    ctx.fillStyle = this.colorKey;
    ctx.rect(left, top, this.getWidth(), this.getheight());
    ctx.stroke();
    ctx.fill();
  }
}
